package design.pattern.prototype.apply1;

/**
 * @author AtoVio, Winter Yuan
 */
public class CitationTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        Citation obj1 = new Citation();
        Student stu1 = new Student("李飞", 1);
        obj1.setStudent(stu1);

        Citation obj2 = obj1.clone();
        Student stu2 = obj2.getStudent();
        // 修改克隆体的引用类型属性的值
        stu2.setName("张山");

        System.out.println(obj1);
        System.out.println(obj2); // 可知是浅克隆
    }
}
